SQL Editor allows you to create and edit SQL text, prepare and execute selected queries. You can define multiple SQL statements in one query window. Drag-and-drop or double-click an identifier in the right Identifiers pane to add it to the editor.
Hint: SELECT statement will be automatically generated in SQL Editor while you build in SQL Builder.
Navicat provides a wide range advanced features, such as compelling code editing capabilities, smart code-completion, SQL formatting, and more.
To change the SQL statement format, simply choose from the Format menu -
Indent
Increase/decrease indent for the selected lines of codes.
Comment
Comment/uncomment the selected lines of codes.
Convert Case
Format the selected codes into upper/lower case.
Beautify SQL (Available only in Non-Essentials Edition)
Format the selected codes with the Beautify SQL settings.
Beautify SQL With (Available only in Non-Essentials Edition)
Change the SQL beautifier options.
Option / Button |
Description |
Short Brace Length |
Set the length of the short brace. |
Upper case keywords |
Format all the SQL keywords to upper case. |
Beautify |
Save and apply the SQL beautifier options. |
Minify SQL (Available only in Non-Essentials Edition)
Minify the format of the SQL in the SQL Editor.
Code completion feature in Navicat pops up a list of suggestions as you type your SQL statement in the editor. It assists you with statement completion and the available properties of database objects, for example databases, tables, fields, views etc with their appropriate icons and information. You can update the code suggestions with latest database information by choosing Edit -> Code Completion -> Update Code Completion Info.
To invoke code completion, just simply press '.' for the available properties of database object currently in the scope.
When the suggestion list appears, press TAB to insert the first item. You can also select the needed item using UPPER ARROW or DOWN ARROW and then press TAB or ENTER.
In addition, code completion can be invoked by typing a character or pressing ESC on your keyboard for SQL keywords/database objects.
If you select a snippet name from the list, the saved code will be inserted to the editor.
Hint: Resize the suggestion list by dragging the lower right corner.
You can enable or disable the code completion feature in Preferences.
Code folding feature enables you to collapse blocks of code such that only the first line of the block appears in SQL Editor.
A block of code that can be folded is indicated by an icon
to the left of the first line of the block. A vertical line extends from the icon to the bottom of the foldable code. In contrast, a folded block of code is indicated by an icon
to left of the code block. You can fold the block by clicking
or expand it by clicking
.
Navicat supports to highlight the matching brace in the editor, i.e. () .
Note: The cursor must be on a brace to show the highlight.
Find
The Find bar is provided for quick searching for the text in the editor. Just simply choose Edit -> Find -> Find from the menu or press COMMAND-F, and then enter a search string.
Incremental searching is used here. As you type, the matched text is found and highlighted instantly. This saves your time from typing the entire text.
The search starts at the cursor's current position to the end of the file.
To find the previous or next occurrence, just simply click
or
.
Replace
To open the Replace bar, simply choose Edit -> Find -> Find and Replace from the menu bar or press OPTION-COMMAND-F. Then, enter the text you want to search and replace.
Click the Replace button to replace the first occurrence.
Click the Replace All button to replace all occurrences automatically.
There are some additional options for Find and Replace, click
:
Option |
Description |
Regular Expression |
Search regular expressions. |
Match Case |
Enable case sensitive search. |
Whole Words |
Return the objects that match the entire word of the search string. |
To copy the SQL statement with quotes, just simply control-click the highlighted SQL. Then, select Copy with Quotes and choose the format.
In the Word Wrap mode, the horizontal scrollbar is removed. SQL statement that exceed the width of the editor window size wraps to the next line. To enable Word Wrap, choose View -> Word Wrap.
Navicat has the ability to zoom in or zoom out the SQL in the editor. The zooming options are available from the View menu. The same effect can be achieved with keyboard shortcuts.
Zoom In: [COMMAND-+]
Zoom Out: [COMMAND--]
Reset: [COMMAND-0]
Note: Editors that are opened in different tabs or windows will not be effected by the zoom.